/**
 * @name        launch.ts
 * @author      shenyc
 * @date        2020-05-06 - ?
 * @copyright   Copy right (c) shenyc (shenyczz@163.com).
 *              All rights reserved.
 *
 ******************************************************************************/
// {{@@@}}
"use strict";
// ----------------------------------------------------------------------------
import { ColorString, LaunchOptions } from "@sfx-lib/core";
import { checkLaunchOptions } from "./common";
import { setupApp } from "./setup-app";
import { unmount } from "./common";

import { $t as t, i18n } from "@sfx-vue-lib/locales";

// import { initPreferences } from '@vben/preferences';
// import { unmountGlobalLoading } from '@vben/utils';
// import { overridesPreferences } from './preferences';
// ----------------------------------------------------------------------------
let workspace = "";
/**
 * 启动应用 - launchApp
 * @param options
 */
function launch(options?: any | LaunchOptions) {
    // 1. 检查启动选项配置
    const opts = checkLaunchOptions(options);

    workspace = opts.workspace;

    // 2. 初始化应用并挂载根容器
    setupApp(opts as LaunchOptions)
        .then((app) => app.mount("#app"))
        .catch((e) => {});

    // 3. 卸载资源
    unmount();
}
// ----------------------------------------------------------------------------
export { launch, workspace, launch as default };
// ----------------------------------------------------------------------------
// {{@@@}}
